using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerSkill : MonoBehaviour
{
    public float skillCooldown = 3f;
    private float lastSkillTime = -1f;
    Animator animator;
    void Start()
    {
        animator = GetComponent<Animator>();
    }
    void Update()
    {

        if (Input.GetKeyDown(KeyCode.K) && Time.time - lastSkillTime >= skillCooldown)
        {
            animator.SetBool("Skill1", true);
            lastSkillTime = Time.time;
            StartCoroutine(DisableControlDuringDash(0.2f));
        }
    }
    System.Collections.IEnumerator DisableControlDuringDash(float duration)
    {
        GetComponent<PlayerMovement>().enabled = false;
        yield return new WaitForSeconds(duration);
        GetComponent<PlayerMovement>().enabled = true;
        animator.SetBool("Skill1", false);
    }

}
